<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="theme-color" content="#000000"/>
    <style>
        #root {
            margin: 50px;
        }

        div {
            padding: 10px;
        }
    </style>
</head>
<body>
<div id="root"></div>

<a href="#/a">go /a</a>
<a href="#/b">go /b</a>

<script>


    //主要是修改Location对象里面的hash值
    let root = document.getElementById('root');

    window.addEventListener('hashchange', (event) => {
        let hash = window.location.hash;
        //如果直接在    192.168.0.105:3000/#/file 加路由，就必须写#
        //赋值的时候不需要写#   window.location.hash='/file'
        root.innerHTML = hash;
    })

</script>
</body>
</html>
